<template>
	<!-- 充值记录 -->
	<view class="wp">
		<view class="list_item" v-for="(item,idx) in list" :key="idx">
			<view class="title">
				<text class="name">时间<text>{{item.createtime}}</text></text>
				<text class="color_2">{{item.typestr}}</text>
			</view>
			<view class="list_li">
				<view class="left" v-if="item.type == '0'">
					<text>充值人</text>
				</view>
				<view class="left" v-if="item.type == '1'">
					<text>申请退款人</text>
				</view>
				<view>{{item.nickname}}</view>
			</view>
			<view class="list_li">
				<view class="left" v-if="item.type == '0'">
					<text>预存现金<text style="font-size: 24upx;">(充值额度)</text></text>
				</view>
				<view class="left" v-if="item.type == '1'">
					<text>退回充值现金</text>
				</view>
				<view>{{item.money}}</view>
			</view>
			<view class="list_li"  v-if="item.type == '0'">
				<view class="left">
					<text>商家赠送额度</text>
				</view>
				<view>{{item.givemoney}}</view>
			</view>
			<view class="list_li"  v-if="item.type == '0'">
				<view class="left">
					<text>实际折扣</text>
				</view>
				<view>{{item.discount}}折</view>
			</view>
			<view class="list_li">
				<view class="left" v-if="item.type == '0'">
					<text>充值额度</text>
				</view>
				<view class="left" v-if="item.type == '1'">
					<text>退回充值额度</text>
				</view>
				<view class="color_2">{{item.allmoney}}</view>
			</view>
			<view class="list_li">
				<view class="left">
					<text>转款证明</text>
				</view>
				<view class="color_3" @click="preImage(item.thumb)">查看凭证</view>
			</view>
		</view>
		<view class="empty">
			<image v-if="isloading" src="../../static/business/loading.gif" mode=""></image>
			<text v-if="!ismore">到底了~</text>
		</view>
		<view class="block"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid: '',
				page: 0,
				list: [],
				isloading: false,
				ismore: true,
			}
		},
		onLoad() {
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			getList() {
				this.page++;
				this.isloading = true;
				this.ismore = true;
				this.$axios('money/checklogs', 'POST', 'member', {
					page: this.page
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						this.list = [...this.list, ...res.data.data];
						this.ismore = res.data.data.length > 0;
					}
				})
			},
			preImage(v) {
				let that = this;
				uni.previewImage({
					urls: [v],
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f2f2f2;
		color: #303133;
		font-size: 28upx;
		letter-spacing: 1px;
	}

	.list_item {
		background: #fff;
		border-radius: 20upx;
		color: #303133;
		margin-top: 20upx;
		padding: 20upx;

		.title {
			border-bottom: 1px #DCDFE6 solid;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30upx;
			font-weight: bold;
			margin-bottom: 20upx;
			padding-bottom: 20upx;

			.name {
				font-size: 32upx;
				color: #000;

				text {
					color: #666;
					font-size: 24upx;
					margin-left: 10upx;
				}
			}

			.time {
				color: #666;
				font-size: 26upx;
				font-weight: normal;
			}
		}

		.list_li,
		.left,
		.list_li1 {
			display: flex;
			align-items: center;
			justify-content: space-between;
			line-height: 55upx;

			.left {
				justify-content: flex-start;
				color: #303133;

				text:nth-of-type(2) {
					margin-left: 20upx;
				}
			}
		}

		.list_li1 {
			justify-content: flex-start;
			flex-wrap: wrap;

			image {
				border-radius: 15upx;
				height: 120upx;
				margin: 20upx 20upx 20upx 0;
				width: 120upx;
			}
		}

		.color_w {
			color: #303133;
		}

		.color_1 {
			color: #927419;
		}

		.color_2 {
			color: $bg-color;
		}

		.color_3 {
			color: rgb(49, 12, 187);
		}
	}

	.empty {
		image {
			height: 60upx;
			width: 60upx;
		}

		padding-top: 30upx;
		text-align: center;
		color: #4399fc;
	}

	.block {
		height: 100upx;
	}
</style>